/*LICENSE_BEGIN
 * ******************************************************************
 * All original parts of SoccerScope2003 have copyright (2003) by
 * Team YowAI, represented by Mr. Shuhei Shiota
 * The Department of Creative Informatics
 * The Graduate School of Information Science and Technology
 * The University of Tokyo
 * 
 * Additional classes (except libraries in /lib) were developed by 
 * the Dainamite Robocup-Team of the DAI-Labor, TU-Berlin 
 * (www.dai-labor.de)
 * 
 * Extended/new classes/packages are:
 *   soccerscope.analyzer.LogfileAnalyzer
 *   soccerscope.daistatistic.*
 *   soccerscope.daistatistic.charts.*
 *   soccerscope.daistatistic.tools.*
 *   soccerscope.db.*
 *   soccerscope.dialog.*
 *   soccerscope.model.PlayerWorldModel
 *   soccerscope.model.SimplePlayer
 *   soccerscope.net.AgentConnector
 *   soccerscope.training.*
 *   soccerscope.training.conditions.*
 * ******************************************************************
LICENSE_END*/
package soccerscope.model.agentplan;

import java.util.Hashtable;

public class CommentDB {
	private static Hashtable<Integer, String> commentdb;

	private CommentDB() {
	}

	static {
		commentdb = new Hashtable<Integer, String>();

	}

	public static void clear() {
		commentdb.clear();
	}

	public static boolean contains(int time, int unum_index) {
		return commentdb.containsKey(new Integer(time * 100 + unum_index));
	}

	public static void putComment(String comment, int time, int unum_index) {
		Integer key = new Integer(time * 100 + unum_index);
		if (commentdb.containsKey(key)) {
			String data = (String) commentdb.get(key);
			commentdb.put(key, new StringBuffer().append(data).append("\n")
					.append(comment).toString());
		} else {
			commentdb.put(key, comment);
		}
	}

	public static String getComment(int time, int unum_index) {
		return (String) commentdb.get(new Integer(time * 100 + unum_index));
	}
}
